<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui">
<body>
	<ui:composition>
		<p:dialog header="Part Unit Detail" widgetVar="partUnitDialog"
			modal="true" showEffect="fade" hideEffect="fade" resizable="false">
			<p:outputPanel id="partUnitDetail" style="text-align:center;">
				<p:panelGrid rendered="#{not empty dtPartUnitLazyView.selectedItem}"
					columnClasses="label,value">
					<f:facet name="header">
						<p:row>
							<p:column>Name</p:column>
							<p:column>Brand</p:column>
							<p:column>Unit</p:column>
							<p:column>Part Number</p:column>
						</p:row>
					</f:facet>
					<p:row>
						<p:column>#{dtPartUnitLazyView.selectedItem.shortName}</p:column>
						<p:column>#{dtPartUnitLazyView.selectedItem.shortBrand}</p:column>
						<p:column>#{dtPartUnitLazyView.selectedItem.shortUnit}</p:column>
						<p:column>#{dtPartUnitLazyView.selectedItem.part}</p:column>
					</p:row>

				</p:panelGrid>

				<br />
				<table border="0">
					<tr>
						<td><p:panelGrid
								rendered="#{not empty dtPartUnitLazyView.selectedItem}"
								columnClasses="label,value">
								<f:facet name="header">
									<p:row>
										<p:column>Order Quantity</p:column>
										<p:column>Action</p:column>
									</p:row>
								</f:facet>
								<p:row>
									<p:column>
										<p:inputText id="quantity"
											value="#{dtPartUnitLazyView.quantity}" required="true"
											requiredMessage="Please enter quantity!">
											<f:convertNumber integerOnly="true" />
										</p:inputText>

										<h:outputText
											value=" #{dtPartUnitLazyView.selectedItem.shortUnit}" />
										<br />
										<h:message for="quantity" />
									</p:column>
									<p:column>
										<p:commandButton value="Add" update=":reqTableForm :prForm @form"
											action="#{dtPartUnitLazyView.addItem}" />
									</p:column>
								</p:row>
							</p:panelGrid></td>
						<td><h:outputText value=" OR " /></td>
						<td><p:panelGrid
								rendered="#{not empty dtPartUnitLazyView.selectedItem}"
								columnClasses="label,value">
								<f:facet name="header">
									<p:row>
										<p:column>Warehouse Reservation</p:column>
										<p:column>Order Quantity</p:column>
										<p:column>Action</p:column>
									</p:row>
								</f:facet>
								<p:row>
									<p:column>
										<p:selectOneMenu id="warehouse"
											value="#{dtPartUnitLazyView.warehouseReserve}">
											<p:ajax
												listener="#{dtPartUnitLazyView.warehouseHasChanged}"
												update="partUnitDetail" />
											<f:selectItems var="returns" value="#{dtPartUnitLazyView.warehouseSelection}"
												itemValue="#{returns.warehouse.id}" itemLabel="#{returns.warehouse.name}" />
										</p:selectOneMenu>
									</p:column>
									<p:column>
										<p:spinner id="qtyOrder"
											value="#{dtPartUnitLazyView.qtyReserveOrder}" min="1"
											max="#{dtPartUnitLazyView.maxQtyReserve}">
											<f:convertNumber integerOnly="true" />
										</p:spinner>
									</p:column>
									<p:column>
										<p:commandButton value="Reserve" update=":clipboardForm @form :partUnitTable"
											action="#{dtPartUnitLazyView.reserve}" />
									</p:column>
								</p:row>
							</p:panelGrid></td>
					</tr>
				</table>
			</p:outputPanel>
		</p:dialog>
	</ui:composition>
</body>
</html>